/**
 * Copyright (c) 2006-2007 Jinyi.lu
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of GNU LGPL license by gun.org
 * which accompanies this distribution, and is available at
 * http://gnu.feld-it.at/copyleft/lesser.html
 * 
 * Project Homepage : http://code.google.com/p/demou
 * Source Code: svn checkout http://demou.googlecode.com/svn/trunk/ demou
 * Mailing list : jinyi.lu@gmail.com
 *                stonelu@126.com
 *
 *  
 * Contributors:
 *     JinYi.Lu - initial API and implementation
 */
package cn.tworen.demou.remoting.cmd;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import cn.tworen.demou.io.AsBean;

/**
 * Created on  2007-2-5
 *
 * Title       : AbsCmd.java
 * Description : 
 * 
 * @author     : LuJinYi
 * @version    : 1.0
 * @Date       : 2007-2-5
 * History     : 
 * 
 */
public abstract class AbsCmd<T>{
	protected Map<String, T> propertyFixed = new HashMap<String, T>();
	protected Map<String, T> propertyDynamic = new HashMap<String, T>();
	public AbsCmd() {
		this.setBody((T)new AsBean());
		this.setHeaders((T)new AsBean());
	}
	public void setFixed(String key, T value) {
		this.propertyFixed.put(key, value);
	}
	public T getFixed(String key) {
		return this.propertyFixed.get(key);
	}
	public void setDynamic(String key, T value) {
		this.propertyDynamic.put(key, value);
	}
	public T getDynamic(String key) {
		return this.propertyDynamic.get(key);
	}
	
	
	/**
	 * @hibernate.property
	 * @return Returns the headers.
	 */
	public T getHeaders() {
		return this.getFixed("headers");
	}
	/**
	 * @param headers the headers to set
	 */
	public void setHeaders(T headers) {
		this.setFixed("headers", headers);
	}
	/**
	 * @hibernate.property
	 * @return Returns the bodies.
	 */
	public T getBody() {
		return this.getFixed("body");
	}
	/**
	 * @param bodies the bodies to set
	 */
	public void setBody(T body) {
		this.setFixed("body", body);
	}

	public T getTimestamp() {
		return this.getFixed("timestamp");
	}
	public void setTimestamp(T timestamp) {
		this.setFixed("timestamp", timestamp);
	}
	public T getTimeToLive() {
		return this.getFixed("timeToLive");
	}
	public void setTimeToLive(T timeToLive) {
		this.setFixed("timeToLive", timeToLive);
	}
	public T getClientId() {
		return this.getFixed("clientId");
	}
	public void setClientId(T clientId) {
		this.setFixed("clientId", clientId);
	}
	public T getDestination() {
		return this.getFixed("destination");
	}
	public void setDestination(T destination) {
		this.setFixed("destination", destination);
	}
	public T getMessageId() {
		return this.getFixed("messageId");
	}
	public void setMessageId(T messageId) {
		this.setFixed("messageId", messageId);
	}
}
